package com.smart.dao;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.smart.common.dao.AbstractDao;
import com.smart.domain.Role;
import com.smart.tools.ObjectHelper;


/**
 * 
 * 版权所有：xxxxxxx
 * @Description: 角色
 * @Title: RoleDao.java 
 * @ClassName: RoleDao 
 * @author tangyan 
 * @date 2019年2月13日 下午6:28:17 
 * @version V1.0
 */
@Repository
@Transactional
public class RoleDao extends AbstractDao<Role>{

	/**
	 * 
	 * @Title: queryRole 
	 * @Description: 查询角色
	 * @author tangyan 
	 * @param conditions
	 * @return
	 */
	public List<Role> queryRole(Map<String, Object> conditions){
		StringBuffer hql = new 	StringBuffer(" from Role r  where r.isDeleted = 0 ");
		if(ObjectHelper.isNotEmpty(conditions.get("roleCode"))){
			hql.append(" and r.roleCode = :roleCode ");
		}
		if(ObjectHelper.isNotEmpty(conditions.get("roleName"))){
			hql.append(" and r.roleName = :roleName ");
		}
		
		return this.findByHql(hql.toString(), conditions);
	}

}
